<extend name="Index:base" />
<block name="content">
                <!-- 中间部分开始 -->
                <div class="main-content">
                    <div class="breadcrumbs" id="breadcrumbs">
                        <script type="text/javascript">
                            try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
                        </script>

                        <!-- 面包屑导航 -->
                        <ul class="breadcrumb">
                            <li>
                                <i class="icon-home home-icon"></i>
                                <a href="__APP__/admin/index">首页</a>
                            </li>
                            <li class="active">会员管理</li>
                        </ul><!-- .breadcrumb -->

                    </div>

                    <div class="page-content">

                        <!-- 页面导航 -->
                        <div class="page-header">
                            <h1>
                                会员管理
                                <small>
                                    <i class="icon-double-angle-right"></i>
                                     查看
                                </small>
                            </h1>
                        </div>

                        <div class="row">
                            <div class="col-xs-12">
                                <div class="row">
                                    <div class="col-xs-12">
                                        <div class="table-responsive">                                      
                                        <!--<div>
                                        <form action="__CONTROLLER__/search" method="get" style="margin-bottom:5px;">
                                        <input type="text" class="user_search" required placeholder="Search" name="uname" style="height:30px;margin-top:5px;">
                                        <input type="submit" value="搜索" style="height:30px;margin-top:-4px;" class="btn btn-xs">
                                        <a href="__CONTROLLER__/insert" class="btn btn-primary"><small><i class="icon-plus-sign bigger-125"></i>    添加用户</small></a>
                                        </form>
                                        </div>-->
                <!--搜索-->
                <div class="row" style="padding:0px;height:auto;overflow:hidden;margin-bottom:10px;">
                                <div class="col-xs-12 col-sm-8">
                                <a class="btn btn-primary pull-left" style="padding:1px 10px;" href="__CONTROLLER__/insert">
                                    <i class="icon-plus-sign bigger-125"></i>
                                    添加用户
                                </a>
                            </div>
                            <div class="col-xs-12 col-sm-4">
                                <form action="__CONTROLLER__/search" method="get">
                                    <div class="input-group pull-right">
                                        <input class="form-control search-query" type="text"  name="uname" placeholder="输入搜索内容...">
                                        <span class="input-group-btn">
                                            <button class="btn btn-info btn-sm" type="submit">
                                                Search
                                                <i class="icon-search icon-on-right bigger-110"></i>
                                            </button>
                                        </span>
                                    </div>
                                </form>
                            </div>
                </div><!--搜索结束-->
                

                                        <div class="table-responsive">
                                            <table id="sample-table-2" class="table table-striped table-bordered table-hover">
                                                <thead>
                                                    <tr>
                                                        <th class="center">
                                                            <label>
                                                                <input type="checkbox" class="ace" id="check"/>
                                                                <span class="lbl"></span>
                                                            </label>
                                                        </th>
                                                        <th>姓名</th>
                                                        <th>真实姓名</th>
                                                        <th>性别</th>
                                                        <th>邮箱</th>
                                                        <th class="hidden-480">会员等级</th>

                                                        <th>
                                                            <i class="icon-time bigger-110 hidden-480"></i>
                                                            积分
                                                        </th>
                                                        <th class="hidden-480">余额</th>
                                                        <th>注册日期</th>
                                                        <th>最后登录时间</th>

                                                        <th>操作</th>
                                                    </tr>
                                                </thead>
                                                <!--一行的开始-->
                                                <!--遍历查询到的数据-->
                                                <foreach name="user" item="v">
            
                                                <tbody>
                                                    <tr>
                                                        <td class="center">
                                                            <label>
                                                                <input type="checkbox" class="ace" name="box"/>
                                                                <span class="lbl"></span>
                                                            </label>
                                                        </td>

                                                        <td>
                                                            <a href="__CONTROLLER__/mod/uid/{$v.uid}">{$v.uname}</a>
                                                        </td>
                                                        <td>{$v.truename}</td>
                                                        <if condition="$v.sex eq 1">
                                                        <td>男</td>
                                                        <elseif condition="$v.sex eq 0" />
                                                        <td></td>
                                                        <else />
                                                        <td>女</td>
                                                        </if>
                                                        <td>{$v.email}</td>
                                                        <td class="hidden-480">{$v.level}</td>
                                                        <td>{$v.scores}</td>
        
                                                        <td class="hidden-480">
                                                            <span class="label label-sm label-warning">余额</span>
                                                        </td>
                                                        <td>{$v.regtime|date="Y-m-d H:i",###}</td>
                                                        <if condition="$v.logintime eq 0">
                                                        <td></td>
                                                        <else />
                                                        <td>{$v.logintime|date="Y-m-d H:i",###}</td>
                                                        </if>
    
                                                        <td>
                                                            <div class="visible-md visible-lg hidden-sm hidden-xs action-buttons">
                                                                <a class="blue" href="__CONTROLLER__/mod/uid/{$v.uid}">
                                                                    <i class="icon-zoom-in bigger-130"></i>
                                                                </a>

                                                                <!--<a class="green" href="">
                                                                    <i class="icon-pencil bigger-130"></i>
                                                                </a>-->

                                                                <a name="del_{$v.uid}" class="red" data-toggle="modal" href="#deleteModal">
                                                                    <i class="icon-trash bigger-130"></i>
                                                                </a>
                                                            </div>

                                                            <div class="visible-xs visible-sm hidden-md hidden-lg">
                                                                <div class="inline position-relative">
                                                                    <button class="btn btn-minier btn-yellow dropdown-toggle" data-toggle="dropdown">
                                                                        <i class="icon-caret-down icon-only bigger-120"></i>
                                                                    </button>

                                                                    <ul class="dropdown-menu dropdown-only-icon dropdown-yellow pull-right dropdown-caret dropdown-close">
                                                                        <li>
                                                                            <a href="#" class="tooltip-info" data-rel="tooltip" title="View">
                                                                                <span class="blue">
                                                                                    <i class="icon-zoom-in bigger-120"></i>
                                                                                </span>
                                                                            </a>
                                                                        </li>

                                                                        <li>
                                                                            <a href="#" class="tooltip-success" data-rel="tooltip" title="Edit">
                                                                                <span class="green">
                                                                                    <i class="icon-edit bigger-120"></i>
                                                                                </span>
                                                                            </a>
                                                                        </li>


                                                                        <li>
                                                                            <a href="#" class="tooltip-error" title="Delete">
                                                                                <span class="red">
                                                                                    <i class="icon-trash bigger-120"></i>
                                                                                </span>
                                                                            </a>
                                                                        </li>
                                                                    </ul>
                                                                </div>
                                                            </div>
                                                        </td>
                                                    </tr>
                                                    <!--遍历结束-->
                                                    </foreach>
                                                    <tr>
                                                        <td colspan=11>{$page}</td>
                                                    </tr>
                                                    <!--一行的结束-->

                                                    
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                                        </div><!-- /.modal-content -->
                                    </div><!-- /.modal-dialog -->
                                </div><!-- PAGE CONTENT ENDS -->
                            <!--</div>--><!-- /.col -->
                        <!--</div>--><!-- /.row -->
                    <!--</div>--><!-- /.page-content -->
                <!--</div>--><!-- /.main-content -->
                 <!-- 删除按钮弹出层 -->
                <div class="modal modal-small fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                    <div class="modal-dialog" style="width:300px;">
                        <div class="modal-content" style="top:160px;left:80%;">
                            <div class="modal-header" style="height:40px;padding:5px 10px;line-height:30px;">
                                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                                <p class="bigger-120" id="myModalLabel">删除数据</p>
                            </div>
                            <div class="modal-body" style="height:70px;padding:5px 10px;line-height:60px;">
                                <p class="text-danger bigger-150">确定删除数据！</p>
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn btn-sm btn-danger" id="delete-data">删除</button>
                                <button type="button" class="btn btn-sm btn-default" data-dismiss="modal">取消</button>
                            </div>
                        </div><!-- /.modal-content -->
                    </div><!-- /.modal-dialog -->
                </div><!-- /.modal -->
                <div id="success-info" class="alert alert-success fade in col-xs-4 hide" style="position:fixed;top:20px;left:35%;z-index:1000;">
                <button class="close" aria-hidden="true" data-dismiss="alert" type="button">×</button>
                <strong></strong>
            </div>
            <div id="error-info" class="alert alert-danger fade in col-xs-4 hide" style="position:fixed;top:20px;left:35%;z-index:1000;">
                <button class="close" aria-hidden="true" data-dismiss="alert" type="button">×</button>
                <strong></strong>
            </div>
            <!-- 删除按钮弹出层结束 -->
                
            
                
            </block>
<block name="privatejs">
        <!-- inline scripts related to this page -->
        
    <script type="text/javascript">
                    jQuery(function($) {

                    //设置当前页面的菜单高亮显示 开始
                    var nownav = "#sidebar a[href*=Member]";
                    var parentattr = $(nownav).parent().parent().attr("class");
                    $(nownav).parent().addClass('active');
                    if (parentattr == 'submenu') {
                    $(nownav).parent().parent().parent().addClass('active open');
                    };
                    //设置当前页面的菜单高亮显示 结束

                    //全选js
                    $('table th input:checkbox').on('click' , function(){
                        var that = this;
                        $(this).closest('table').find('tr > td:first-child input:checkbox')
                        .each(function(){
                        this.checked = that.checked;
                        $(this).closest('tr').toggleClass('selected');
                    });

                    });

                    var delid;
                    var delline;
                    $('a[name^=del]').on('click',function(){
                        delid = ($(this).attr('name').split('_'))[1];
                        delline = $(this).parent().parent().parent();
                    });

                    $('#delete-data').on('click',function(){
                    $.ajax({
                        url:"__CONTROLLER__/del",
                        type:"get",
                        data:{uid:delid},
                        success:function(data){
                            if (data == 1) {
                                warningInfo("#success-info","删除成功！");
                                location.href='';
                            }else if(data == 2){
                                warningInfo("#error-info","没有删除权限！");
                            }else{
                                warningInfo("#error-info","删除失败！");
                            }
                            $('#deleteModal').modal('hide');
                       }
                });
            });
             //信息提示函数
            function warningInfo(id,info){
                    $(id).removeClass('hide');
                    $(id).fadeOut(0);
                    $(id).children().eq(1).html(info);
                    $(id).fadeToggle(0).delay(1000).fadeToggle(1000);
                }

                });
    </script>
</block>

